package com.team.activity.mapper;

import com.team.activity.domain.BizActivityPushLog;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
* @author 王双印
* @description 针对表【biz_activity_push_log】的数据库操作Mapper
* @createDate 2025-07-14 21:14:01
* @Entity com.team.activity.domain.BizActivityPushLog
*/
public interface BizActivityPushLogMapper {

    int deleteByPrimaryKey(Long id);

    int insert(BizActivityPushLog record);

    int insertSelective(BizActivityPushLog record);

    BizActivityPushLog selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(BizActivityPushLog record);

    int updateByPrimaryKey(BizActivityPushLog record);


    /**
     * 统计用户未读活动消息数量
     */
    @Select("select count(1) from biz_activity_push_log where user_id = #{userId} and status = 0")
    int countUnreadByUserId(Long userId);

    @Update("update biz_activity_push_log set status = 1 where activity_id = #{activityId} and user_id = #{userId}")
    BizActivityPushLog updateByActivityAndUserId(Long activityId, Long userId);

    @Select("select * from biz_activity_push_log where activity_id = #{activityId} and user_id = #{userId}")
    BizActivityPushLog selectByActivityIdAndUserId(Long activityId, Long userId);
}
